Null terminate array, add space on closing tags in chain for Topografix.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 1 Jan 2003 17:03:20 +0000 (17:03 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 1 Jan 2003 17:03:20 +0000 (17:03 +0000)
fixes from Alex and Ron.

gpsbabel/gpx.c

index 4ae86bbf5d69497d2fc25921ce4ee28e48dfc994..520f3c2eaa49ce339276a5284fcfa4870a87c91a 100644 (file)
@@ -156,13 +156,14 @@ start_something_else(const char *el, const char **attrv)
        
        /* copy attributes */
        avp = attrv;
-       new_tag->attributes = (char **)xcalloc(sizeof(char *),attr_count);
+       new_tag->attributes = (char **)xcalloc(sizeof(char *),attr_count+1);
        avcp = new_tag->attributes;
        while (*avp) {
                *avcp = xstrdup(*avp);
                avcp++;
                avp++;
        }
+       *avcp = NULL;
        
        if ( cur_tag ) {
                if ( cur_tag->child ) {
@@ -597,7 +598,7 @@ fprint_xml_chain( xml_tag *tag )
        char *tmp_ent;
        while ( tag ) {
                if ( !tag->cdata && !tag->child ) {
-                       fprint_tag_and_attrs( "<", "/>", tag );
+                       fprint_tag_and_attrs( "<", " />", tag );
                }
                else {
                        fprint_tag_and_attrs( "<", ">", tag );